package com.bchun.gamepk.service;

import java.io.Serializable;

import org.springframework.dao.DataAccessException;

import com.bchun.gamepk.model.Page;

public interface IBaseService<T> {

	/**
	 * 根据Model删除记录
	 * 
	 * @param model
	 * @throws DataAccessException
	 */
	public void delete(T model) throws DataAccessException;

	/**
	 * 根据ID删除记录
	 * 
	 * @param id
	 * @return
	 * @throws DataAccessException
	 */
	public int deleteById(Object id) throws DataAccessException;

	/**
	 * 插入对象
	 * 
	 * @param model
	 * @return
	 * @throws DataAccessException
	 */
	public Object insert(T model) throws DataAccessException;

	/**
	 * 根据ID查询对象
	 * 
	 * @param id
	 * @return
	 */
	public T getById(Class<T> cls, Serializable id);

	/**
	 * 分页查询对象
	 * 
	 * @param page
	 * @return
	 */
	public Page<T> selectByPage(Page<T> page);

	/**
	 * 更新对象
	 * 
	 * @param model
	 * @throws DataAccessException
	 */
	public void update(T model) throws DataAccessException;

}
